/**   
 * @Title: ModifyUserInfoCommunicater.java 
 * @Package: com.esun.rabbit2.communicaters.myinfo 
 * @Description: (修改用户信息接口) 
 * @Author: Billy qigs@500wan.com   
 * @Date: 2011-8-8 下午05:06:37  
 * Copyright (C) 2011 Shenzhen E-sun Sky Net Technology Co.,ltd.
 */
package com.esun.rabbit2.communicaters.myinfo;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;

import javax.xml.parsers.ParserConfigurationException;

import org.apache.http.client.ClientProtocolException;
import org.xml.sax.SAXException;

import com.esun.config.BussinessCode;
import com.esun.config.Key;
import com.esun.model.UserInfo;
import com.esun.network.ServerCommunicater;

/**
 * @ClassName: ModifyUserInfoCommunicater
 * @Description: (修改用户信息接口)
 * @Author: Billy qigs@500wan.com
 * @Date: 2011-8-8 下午05:06:37
 */
public class ModifyUserInfoCommunicater extends ServerCommunicater {

	public boolean modifyUserInfo(String pwd, String address, String mobile, String email, String postCode, String sex) throws ClientProtocolException, IOException, ParserConfigurationException,
			SAXException {
		ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();

		list.add(mapItem(BussinessCode.PASER_MID, BussinessCode.MID_CHANGE_USERINFO));
		list.add(mapItem(BussinessCode.PASER_CK, UserInfo.getUserInfo().getUserSession()));
		list.add(mapItem(Key.KEY_PASSWORD, pwd));
		list.add(mapItem(Key.KEY_ADDRESS, address));
		list.add(mapItem(Key.KEY_MOBILE, mobile));
		list.add(mapItem(Key.KEY_EMAIL, email));
		list.add(mapItem(Key.KEY_POSTCODE, postCode));
		list.add(mapItem(Key.KEY_SEX, sex));

		super.getServerResponse(list, true);

		if (super.getState() == 100) {
			return true;
		} else {
			return false;
		}
	}

	private HashMap<String, String> mapItem(String name, String value) {
		HashMap<String, String> map = new HashMap<String, String>();
		map.put(name, value);
		return map;
	}
}
